<template>
	<view class="title"><text>请选择要绑定的就诊人</text></view>
	<view class="header-box" v-for="v in Data.user" :key="v">
		<view class="header" @click="checkInpatientInformation(v.id)">
			<view class="personal-information">
				<text>{{v.name}}</text>
				<view><text>{{v.relationType}}</text></view>
			</view>
			<view class="date"><text>{{v.cardNum}}</text></view>
		</view>
	</view>
</template>

<script setup>
	import {patientList} from '@/api/TopUpService'
	import {BindInpatientApi} from '@/api/ViewServices'
	import {reportFormStore} from '@/store/reportFormStore'
	import {useLoginStore} from '@/store/loginStore'
	
	import {onMounted, reactive} from 'vue'
	import http from '@/utils/http'
	
	
	let Data=reactive({
		user:[]
	})
	const userId=useLoginStore()
	let id=userId.id
	
let checkInpatientInformation = (id) => {
	uni.navigateTo({
		url:
			`/pages/personHospital/confirmPersonHospitalInfo/confirmPersonHospitalInfo?id=${id}`
	})
	BindInpatientApi(id).then((res)=>{
		console.log('res',res)
	})
}
onMounted(()=>{
	patientList({id:id}).then(({data})=>{
		Data.user=data.data
		Data.user.forEach(v=>{
			switch (v.relationType) {
				case 0:
					v.relationType = '本人'
					break
				case 1:
					v.relationType = '子女'
					break
				case 2:
					v.relationType = '夫妻'
					break
				case 3:
					v.relationType = '父母'
					break
				case 4:
					v.relationType = '朋友'
					break
			}
		})
		console.log('user1',Data.user)
		
	})
})
</script>

<style scoped lang="less">
.title {
	width: 750rpx;
	height: 120rpx;
	display: flex;
	align-items: center;
	text {
		margin-left: 30rpx;
		font-size: 30rpx;
	}
}
.header-box {
	width: 750rpx;
	height: 178rpx;
	margin-bottom: 28rpx;
	display: flex;
	justify-content: center;
	align-items: center;
}
.header {
	width: 688rpx;
	height: 178rpx;
	border-radius: 10rpx;
	background: #f3f8fe;
	display: flex;
	flex-direction: column;
	justify-content: center;
	.personal-information {
		width: 630rpx;
		height: 44rpx;
		margin: 0 30rpx;
		font-size: 30rpx;
		display: flex;
		color: #474848;
		view {
			width: 86rpx;
			height: 40rpx;
			background-color: #e0ecfe;
			color: #4897fe;
			border-radius: 30rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-left: 22rpx;
		}
	}
	.date {
		margin: 26rpx 0 0 30rpx;
		font-size: 24rpx;
		color: #acabaa;
	}
}
</style>
